#pragma once


#include <algorithm>
#include "NtAutoPtr.h"
#include "NtVisibleObject.h"
#include "NtTransactionProcess.h"
#include "NtCamera.h"

class NtScene: public NtCountedObject
{
public:
	NtScene(void);
	~NtScene(void);

	void InitScene();
	void Render();
	void Update(DWORD dwTimer);

	NtCamera* GetCamera() { return &m_DefaultCamera; }

	LRESULT OnMessage(HWND hWnd, UINT Id, WPARAM wParam, LPARAM lParam);

	void AddVisibleObject( NtVisibleObjectPtr pObject)
	{
		m_VisibleObjectList.push_back(pObject);
	}

	void RemoveVisibleObject(NtVisibleObjectPtr pObject)
	{ 	
		m_VisibleObjectList.erase( std::remove(m_VisibleObjectList.begin(), 
			m_VisibleObjectList.end(), pObject), m_VisibleObjectList.end());
	}

	void AddTransactionProcess(NtTransactionProcessPtr pProcess)
	{
		m_TransactionProcessVector.push_back( pProcess);
	}

	void RemoveTransactionProcess(NtTransactionProcessPtr pObject)
	{ 	
		m_TransactionProcessVector.erase( std::remove(m_TransactionProcessVector.begin(), 
			m_TransactionProcessVector.end(), pObject), m_TransactionProcessVector.end());
	}

	void ReleaseScene();

protected:
	std::vector<NtVisibleObjectPtr> m_VisibleObjectList;
	std::vector<NtTransactionProcessPtr> m_TransactionProcessVector;
	LPDIRECT3DDEVICE9 m_Device9;
	NtCamera m_DefaultCamera;
};

NtAutoPtr(NtScene);
